﻿// Copyright 2012 T4C: sejerpz@gmail.com
// Licensed under GPL v3

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SET
{
    public partial class FormReponseInput : Form
    {
        public FormReponseInput()
        {
            InitializeComponent();
            ValidateInput();
        }

        public int Interval
        {
            get
            {
                int r;
                if (int.TryParse(textBoxResponse.Text, out r))
                {
                    return r;
                }
                else
                    return -1;
            }
        }

        private void textBoxResponse_TextChanged(object sender, EventArgs e)
        {
            ValidateInput();
        }

        private void ValidateInput()
        {
            int dummy;
            buttonOk.Enabled = int.TryParse(textBoxResponse.Text, out dummy);
        }

        private void textBoxResponse_Enter(object sender, EventArgs e)
        {
            textBoxResponse.SelectAll();
        }
    }
}
